import { FuWuEntry } from "../models/fuwu_entry";
import { UserEntry } from "../models/user_entry";
import request from "./request";

export class APIPaths{
    static readonly GET_FUWU_API="/api/xxx";
    static readonly USER_DETAIL = (id: number) => `/users/${id}`;
}
// 用户 API
export const userApi = {
  // 登录
  login: (params: {mobile:string;password:string}): Promise<string> => {
    return request.post('/api/user/login', params);
  },

  // 获取用户信息
  getUserInfo: (): Promise<UserEntry> => {
    return request.get('/api/user/info');
  },

  // 获取用户列表（分页）
  getUserList: (params: { page: number; pageSize: number }): Promise<UserEntry[]> => {
    return request.get('/api/user/list', { params });
  },

  // 更新用户信息
  updateUser: (id: number, data: Partial<UserEntry>): Promise<UserEntry> => {
    return request.put(`/api/user/${id}`, data);
  },

  // 删除用户
  deleteUser: (id: number): Promise<void> => {
    return request.delete(`/api/user/${id}`);
  },

  getFuwuList:(params:{sid:string}):Promise<FuWuEntry[]>=>{
    return request.get("/api/store/fuwu",{params})
  }
};